package cn.kxx.service.impl;

import cn.kxx.mapper.OrderMapper;
import cn.kxx.pojo.Member;
import cn.kxx.pojo.Orders;
import cn.kxx.pojo.Product;
import cn.kxx.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: Kong Xiang Xiang
 * @Date: 2022/10/31 17:49
 * @DESC:
 */
@Service
public class OrderServiceImpl implements OrderService {


    @Autowired
    private OrderMapper orderMapper;

    //查询所有订单
    @Override
    public List<Orders> findAll() {
       List<Orders> list = orderMapper.findAll();
       return list;
    }

    //查询订单详情
    @Override
    public Orders findById(Integer id) {

       Orders list =  orderMapper.findById(id);
       return list;

    }

    //修改订单的产品种类
    @Override
    public List<Product> findProductList() {

      List<Product> list = orderMapper.findProductList();
        return list;
    }
    //修改订单的联系人
    @Override
    public List<Member> findMemberList() {
        List<Member> list = orderMapper.findMemberList();
        return list;
    }

    //保存修改
    @Override
    public void edit(Orders orders) {

        orderMapper.edit(orders);
    }

    //新建订单
    @Override
    public void save(Orders orders) {

        orderMapper.save(orders);

    }
}
